// import base64 from './base64-1.7.js'
// import md5 from './md5.js'
import md5 from 'js-md5';

let base64 = require('js-base64').Base64;

const encrypt = (reqObj) => {
  const reqString = JSON.stringify(reqObj);
  const reqData = base64.encode(reqString);
  const signKey = 'N6VJUhg9D4f5WWwgopgXebM1zhUKpQOD';
  const sign = md5(reqString + signKey);
  const ts = new Date().getTime();
  return {
    reqData,
    sign,
    ts
  };
}

export default encrypt
